class TypeIncidentsController < ApplicationController
  before_filter :check_authentication, :except => [:show, :index]
  # GET /type_incidents
  # GET /type_incidents.xml
  def index
    @type_incidents = TypeIncident.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @type_incidents }
    end
  end

  # GET /type_incidents/1
  # GET /type_incidents/1.xml
  def show
    @type_incident = TypeIncident.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @type_incident }
    end
  end

  # GET /type_incidents/new
  # GET /type_incidents/new.xml
  def new
    @type_incident = TypeIncident.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @type_incident }
    end
  end

  # GET /type_incidents/1/edit
  def edit
    @type_incident = TypeIncident.find(params[:id])
  end

  # POST /type_incidents
  # POST /type_incidents.xml
  def create
    @type_incident = TypeIncident.new(params[:type_incident])

    respond_to do |format|
      if @type_incident.save
        flash[:notice] = 'TypeIncident was successfully created.'
        format.html { redirect_to(@type_incident) }
        format.xml  { render :xml => @type_incident, :status => :created, :location => @type_incident }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @type_incident.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /type_incidents/1
  # PUT /type_incidents/1.xml
  def update
    @type_incident = TypeIncident.find(params[:id])

    respond_to do |format|
      if @type_incident.update_attributes(params[:type_incident])
        flash[:notice] = 'TypeIncident was successfully updated.'
        format.html { redirect_to(@type_incident) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @type_incident.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /type_incidents/1
  # DELETE /type_incidents/1.xml
  def destroy
    @type_incident = TypeIncident.find(params[:id])
    @type_incident.destroy

    respond_to do |format|
      format.html { redirect_to(type_incidents_url) }
      format.xml  { head :ok }
    end
  end
end
